ci(security): add Bandit static analysis workflow.#365
Open
kefaslungu wants to merge 3 commits intoEAPD-DRB:mainfrom
Open
ci(security): add Bandit static analysis workflow.#365kefaslungu wants to merge 3 commits intoEAPD-DRB:mainfrom
kefaslungu wants to merge 3 commits intoEAPD-DRB:mainfrom
Conversation
Signed-off-by: kefaslungu <jameskefaslungu@gmail.com>
Signed-off-by: kefaslungu <jameskefaslungu@gmail.com>
Signed-off-by: kefaslungu <jameskefaslungu@gmail.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Existing related work reviewed
chore: add pre-commit hooks and linting configuration (black, flake8, eslint) #319 adds pre-commit hooks (black, flake8, eslint) no security analysis.
This PR introduces static security analysis to the pipeline.
Overlap assessment
Bandit or any other Python SAST tool. This fills the security scanning gap
explicitly left open by [Enhancement] Establish CI/CD Pipeline with GitHub Actions for Linting, Testing, and Build Verification #58.
Why this PR should proceed
merges without any check for high-severity Python vulnerabilities.
Medium (B104 hardcoded bind-all-interfaces) were found in the existing
codebase during development of this PR.
findings inline on future PRs without requiring contributors to read logs.
Summary
.github/workflows/bandit.yml— Bandit security scan workflow triggered onpush/PR to main and manually via workflow_dispatch. Fails on High severity,
reports Medium/Low as non-blocking. Outputs SARIF to GitHub Security tab
and uploads full report as artifact. Bandit and formatter versions pinned.
Pip dependencies cached.
API/app.pyadded# nosec B201to suppress known,accepted High finding in the dev-only Flask fallback path.
.gitignore— added*.sarifto exclude generated scan artifacts.automatically scanned for high-severity Python vulnerabilities.
Validation
Local validation:
bandit -r API/ --severity-level high→ exit 0, no issues after nosec annotationbandit -r API/ --severity-level low→ exit 1 (findings exist), handled correctlyBoth SARIF files verified as valid JSON
Docs updated in this PR (not applicable)
Any setup/workflow changes reflected in repo docs (workflow is self-documenting)
Scope check
feature/58-bandit-security-scan)OSeMOSYS/MUIOdependencyEAPD-DRB/MUIOGO:main(not upstream)Exception rationale